class Solution
{
public:
    ListNode* swapPairs(ListNode* head)
    {
        if (head == nullptr || head->next == nullptr)
            return head;

        auto A = head;
        auto B = head->next;
        auto C = B->next;

        A->next = swapPairs(C);
        B->next = A;

        return B;
    }
};